package com.cuitrip.util;

import android.location.Location;
import android.location.LocationManager;
import android.util.Pair;

import com.lab.rtenvironment.AppCoreRuntime;

/**
 * Created by ak on 15/10/28.
 */
public class LocationUtil {

    public static Pair<String,String> getLocation(){
        LocationManager locationManager = (LocationManager) AppCoreRuntime.context.getSystemService(AppCoreRuntime.context.LOCATION_SERVICE);
        String latitude = "";
        String longitude = "";
        if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
            Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
            if(location != null){
                latitude = String.valueOf(location.getLatitude());
                longitude = String.valueOf(location.getLongitude());
            }
        }
        return Pair.create(latitude,longitude);
    }
}
